Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-input-field
Advanced tools
A carefully crafted input field for React
See demo at http://zippyui.com/react-input-field/
var Field = require('react-input-field')
var VALUE = 'initial value'
var App = React.createClass({
// ********
// NOTE: the first argument is the new value, NOT the event
// ********
handleChange: function(value){
VALUE = value
this.setState({})
},
render: function(){
function validate(value){
return value !== ''
}
return <Field onChange={this.handleChange} validate={validate} />
}
})
React.render(<App />, document.body)
Unlike normal <input>
fields (React.DOM.input), react-input-field
calls the onChange
handler with the input value being the first arg!
function onChange(value, fieldProps, event){
console.log(value)
}
<Field onChange={onChange} />
isEmpty
prop - default implementation is value == null
)validate
function prop)validate
function prop)In order to perform validation, simply provide a validate
function.
Example:
function validate(value, props){
return value === ""
}
<Field validate={validate} defaultValue="test" />
When validate
returns false, invalidClassName
and invalidStyle
are applied.
Configuring the <input />
directly can be done using the inputProps
prop (because style, emptyStyle, emptyClassName, etc... are applied to the wrapping div, not the input
itself)
Example
<Field inputProps={{type: 'tel'}} />
But most of the time you wont need to use inputProps
directly.
Example - no need to specify the onFocus
callback on inputProps
, since it is called due to event delegation.
function onFocus(event){
//called on input focus
}
<Field onFocus={onFocus} />
<Field inputStyle={{color: 'blue'}} />
Use Github issues for feature requests and bug reports.
We actively welcome pull requests.
For setting up & starting the project locally, use:
$ git clone https://github.com/zippyui/react-input-field
$ cd react-input-field
$ npm install
$ npm run dev
Now navigate to localhost:9090
Before building a new version, make sure you run
$ npm run build
which compiles the src
folder (which contains jsx files) into the lib
folder (only valid EcmaScript 5 files).
FAQs
React Input Field
The npm package react-input-field receives a total of 24 weekly downloads. As such, react-input-field popularity was classified as not popular.
We found that react-input-field demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.